<?php

use yii\db\Migration;

class m170804_033750_create_recharge extends Migration
{

    // Use up()/down() to run migration code without a transaction.
    public function safeUp()
    {
        $this->createTable('{{%recharge}}',[
            'id' => $this->primaryKey()->notNull().' COMMENT \'自增id\'',
            'customer_id' => $this->integer()->defaultValue(0).' COMMENT \'会员id\'',
            'site_id' => $this->smallInteger()->defaultValue(0).' COMMENT \'分店id\'',
            'cash' => $this->decimal(10,2)->defaultValue(0).' COMMENT \'充值金额\'',
            'surplus_cash' => $this->decimal(10,2)->defaultValue(0).' COMMENT \'剩余金额\'',
            'frequency' => $this->smallInteger()->defaultValue(0).' COMMENT \'充值次数\'',
            'created_at' => $this->integer()->defaultValue(0).' COMMENT \'充值时间\'',
            'isuser_id' => $this->integer()->defaultValue(0).' COMMENT \'教服id\'',
        ]);

    }

    public function safeDown()
    {
        $this->dropTable('{{%recharge}}');
    }

}
